
package vu.cs.heuristieken;

public abstract class Entity implements Cloneable {
    private   int     width;
    private   int     depth;
    private   boolean rotated;

    public Entity(Size size) {
        this(size, false);
    }

    public Entity(Size size, boolean rotated) {
        this.width   = size.getWidth();
        this.depth   = size.getDepth();
        this.rotated = rotated;
    }

    public int getWidth() {
        return (this.rotated)? this.depth : this.width;
    }

    public int getDepth() {
        return (this.rotated)? this.width : this.depth;
    }

    public int getValue() {
        return 0;
    }

    public void rotate() {
        this.rotated = !this.rotated;
    }

    public boolean isRotatable() {
        return (this.getWidth() != this.getDepth());
    }

    public boolean isRotated() {
        return this.rotated;
    }

    public Entity clone() 
        throws CloneNotSupportedException {
        return (Entity) super.clone();
    }
}
